﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using attendance.L3Bussobject;
using attendance.L2Busslogic;

namespace attendance.L4View.master
{
    public partial class master_delete_info : System.Web.UI.Page
    {
        public static string sname;
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text.Length == 0)
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('名字不能为空 ');</script>");
                return;

            }
            studentOB mydd = new studentOB();
            mydd = studentBL.Getwordsingle(TextBox1.Text.Trim());
            if (mydd.name.Trim() == "访问数据库不成功！")
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('没有该条记录 ');</script>");
                return;
            }
            sname = mydd.name;
            TextBox1.Text = mydd.name;
            Label6.Text = mydd.numb;
            Image1.ImageUrl = mydd.photo;
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            if (!studentBL.deleteword(sname))
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('删除不成功 ');</script>");
                return;
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('删除成功 ');</script>");
                TextBox1.Text = " ";
                Label6.Text = " ";
                Image1.ImageUrl = " ";
            }
        }
    }
}